const msgHandle = {
    getLastCommitMsg: () => `__GETCOMMITMSG__`,
}

const toggle = () => {
    if(window) {
        const isAllowGetCommitMsg = !window.isAllowGetCommitMsg ?? true;
        window.isAllowGetCommitMsg = isAllowGetCommitMsg;
        
        if(isAllowGetCommitMsg) {
            window.msgHandle = msgHandle;
        } else {
            delete window.msgHandle;
        }
    }
}

if(window) {
    window.toggle = () => {};
    window.isAllowGetCommitMsg = false;
}

Object.defineProperty(window, 'toggle', {
    get: () => {
        return toggle;
    }
})

